package com.hightrast.service.controller;


import com.hightrast.service.api.baseEntity.R;
import com.hightrast.service.api.domain.qo.rastUserRoleAuth.QueryRastUserRoleAuthListQo;
import com.hightrast.service.api.domain.qo.rastUserRoleAuth.UpdateRastUserRoleAuthStatusQo;
import com.hightrast.service.api.entity.RastUserRoleAuth;
import com.hightrast.service.service.IRastUserRoleAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户角色授权申请表 前端控制器
 * </p>
 *
 * @author hx
 * @since 2025-01-19
 */
@RestController
@RequestMapping("/api/rast-user-role-auth")
@Api(tags = "用户角色授权申请")
public class RastUserRoleAuthController {
    @Resource
    IRastUserRoleAuthService userRoleAuthService;

    @ApiOperation("获取申请授权角色用户列表")
    @PostMapping("/queryUserRoleAuthList")
    public R<List<RastUserRoleAuth>> queryUserRoleAuthList(@RequestBody QueryRastUserRoleAuthListQo qo) {
        return R.data(userRoleAuthService.queryUserRoleAuthList(qo));
    }

    @ApiOperation("修改用户申请权限状态")
    @PostMapping("/updateUserRoleAuthStatus")
    public R<Void> updateUserRoleAuthStatus(@RequestBody @Validated UpdateRastUserRoleAuthStatusQo qo) {
        userRoleAuthService.updateUserRoleAuthStatus(qo);
        return R.success();
    }
}
